<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/layui.css">
<title>教师管理</title>
</head>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<body>
<ul class="layui-nav layui-bg-blue">
		<form action="${pageContext.request.contextPath}/Admininfocontroller/AddTeacher" name="form1" method="post">
    <li class="layui-nav-item"><input type="text" name="tid" id="tid" placeholder="请输入教师工号"  class="layui-input"></li>
    <li class="layui-nav-item"><input type="text" name="tname" id="tname" placeholder="请输入教师姓名"  class="layui-input"></li>
  <li class="layui-nav-item"><input type="text" name="tclass" id="tclass" placeholder="请输入教师班级"  class="layui-input"></li>
      <li class="layui-nav-item"><input type="text" name="tpassword" id="tpassword" placeholder="请输入登录密码"  class="layui-input"></li>
  <li class="layui-nav-item"><input type="text" name="tmail" id="tmail" placeholder="请输入邮箱账号"  class="layui-input"></li>
    <li class="layui-nav-item"><a href='javascript:document.form1.submit();' style="font-size: 20px;" >添加</font></a></li>
        <li class="layui-nav-item" style="float:right; "><a href="<%=basePath%>logout.jsp" style="font-size: 20px;"><i class="fa fa-times-circle" aria-hidden="true"></i> 退出登录</a></li>
   </form>
    
</ul>

 <div style="height:450px">
    <table class="layui-table" style="margin-top:15px;">
        <colgroup>
         
         
        </colgroup>
        <thead>
        <tr>
            <th>教师工号</th>
            <th>教师姓名</th>
            <th>教师班级</th>
            <th>登录密码</th>
            <th>邮箱账号</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pageInfo.list}" var="c">
            <tr>
                <td>${c.tid}</td>
                <td>${c.tname}</td>
                <td>${c.tclass}</td>
                <td>${c.tpassword}</td>
                <td>${c.tmail}</td>

 				 <td><a href="${pageContext.request.contextPath}/Admininfocontroller/delete?tid=${c.tid}" style="color: #000;" onclick="javascropt:return confirm('确定要删除吗？');">删除</a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    
	</div>
	<div style="text-align:center; margin-top:10px; margin-left:-100px;">
		<c:if test="${pageInfo.total>=0}">
			<p style=" color: black; font-size:16px; margin-bottom:10px;">当前第 ${pageInfo.pageNum}
				页/共 ${pageInfo.pages} 页</p>
			<c:choose>
				<c:when test="${pageInfo.pageNum==1}">
					<button class="layui-btn layui-btn-disabled">首页</button>
					<button class="layui-btn layui-btn-disabled">上一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
				</c:when>
				<c:when test="${pageInfo.pageNum>=1 && pageInfo.pageNum<pageInfo.pages}">
					<button class="layui-btn " onclick="goPage(1)">首页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
				</c:when>
				<c:when test="${pageInfo.pages==1}">
					<button class="layui-btn layui-btn-disabled">首页</button>
					<button class="layui-btn layui-btn-disabled" ">上一页</button>
                    <button class=" layui-btn
					 layui-btn-disabled">下一页</button>
					<button class="layui-btn layui-btn-disabled">末页</button>
				</c:when>
				<c:when test="${pageInfo.pageNum==pageInfo.pages && pageInfo.pages>=1}">
					<button class="layui-btn " onclick="goPage(1)">首页</button>
					<button class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
					<button class="layui-btn layui-btn-disabled">下一页</button>
					<button class="layui-btn layui-btn-disabled">末页</button>
				</c:when>

			</c:choose>
		</c:if>

	</div>
	<script type="text/javascript">
	function goPage(num) {
		location.href = "/ElectiveSystem/Admininfocontroller/Teacherlist?pageNum=" + num;
	}
</script>
</body>
</html>

